<template>
	<view class='icon'>
		<view class='icon-item' v-for="(item,index) in iconList" :key='index' @click="goToPage(item.type)">
			<image :src="item.url" mode="" class="item-image"></image>
			<view class="icon-title">{{item.title}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			};
		},
		props: {
			iconList: {
				type: [Array, Object],
				default: () => {
					return [{
							url: '/static/icon/an1.png',
							title: '明星企业',
							type: 1
						},
						{
							url: '/static/icon/an2.png',
							title: '企业名片',
							type: 2
						},
						{
							url: '/static/icon/an3.png',
							title: '每日任务',
							type: 3
						},
						{
							url: '/static/icon/an4.png',
							title: '公告',
							type: 4
						}
					];
				}
			}
		},
		methods: {
			//跳转页面
			goToPage(type) {
				let url = '';
				switch (type) {
					case 1:
						url = '';
						break;
					case 2:
						url = '';
						break;
					case 3:
						url = '';
						break;
					default:
				}

				if (url) {
					uni.navigateTo({
						url
					})
				}
			},
		}
	}
</script>

<style>
	.icon {
		width: 100%;
		margin: 0px auto;
		display: flex;
		border-top: 20upx solid #F5F5F5;
		border-bottom: 20upx solid #F5F5F5;
	}

	.icon-item {
		flex: 1;
		width: 56upx;
		height: 200upx;
		line-height: 200upx;
		display: flex;
		flex-direction: column;
	}

	.item-image {
		width: 100upx;
		height: 100upx;
		margin: 20upx auto;
	}

	.icon-title {
		font-size: 28upx;
		height: 40upx;
		line-height: 40upx;
		text-align: center;
		color: #444;
	}
</style>
